<?php /* COMPANIES $Id: do_company_aed.php,v 1.9.2.1 2006/07/25 20:24:13 merlinyoda Exp $ */


$results = array('success' => TRUE, 'messages' => '');

$obj = new CSupplier();
$perms =& $AppUI->acl();
$canEdit = $perms->checkModuleItem($m, 'edit');
if (!$canEdit) {
	$results['success'] = FALSE;
	$results['errors'] = 'Access denined';
} else if (!$obj->bind($_POST )) {
	$results['success'] = FALSE;
	$results['errors'] = $obj->_error;
} else {
	if (($msg = $obj->store()) != '') {
		$results['success'] = FALSE;
		$results['messages'] = $msg;
	};
}

header('Content-Type: text/xml');

$xml = new XmlWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');

$xml->startElement('root');

$xml->writeElement('sup_id', $obj->sup_id);
$xml->writeElement('success', $results['success'] ? 'true' : 'false');
$xml->writeElement('messages', $results['messages']);
$xml->writeElement('errors', $results['messages']);

$xml->endElement();

echo $xml->outputMemory(true);
?>